<template>
  <div>
    购物车组件
    <h1 v-if="navFlag">显示隐藏的组件内容</h1>
    <button @click="turn"> 跳转关于</button>
    <h1>{{$store.state.num}}</h1>
    <h1>{{num}}</h1>
    <h1>{{numGetters}}</h1>
    <button @click="change">mutations改变</button>
    <button @click="changeaActions">actions改变</button>
    <button @click="numActions(50)">actions改变</button>
    <router-link :to="{name:'Home',params:{mycid:999}}">跳转主页</router-link>
  </div>
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
export default {
  name: "cart",
  data () {
    return {

    }
  },
  computed: {
    ...mapState(['num', 'navFlag']),
    ...mapGetters(['numGetters']),
  },
  methods: {
    ...mapMutations(["changeNum"]),
    ...mapActions(["numActions"]),
    turn () {
      // this.$router.push("/about");
      // this.$router.push({ name: "About" })
      // this.$router.push({ name: "About", params: { pid: 888 } })
      this.$router.push({ name: "About", query: { pid: 999 } })

    },
    change () {
      this.changeNum(100)
    },
    changeaActions () {
      this.numActions(50)
    }
  },
}
</script>
<style lang="less">
</style>